<#import "../tpl/pageTep.ftl" as page>
<@page.pageBase currentMenu="收款登记">

    <!--suppress ALL -->
    <form id="searchForm" class="form-panel">
        <a href="${basepath}/rest/manage/finance/toList" class="backPage">返回上一级</a>
        <ul class="panel-content">
            <li>
                <div class="form-actions">
                    <div class="control-group controls span5">
                        <input type="text" class="input-normal  input-pad" name="proxyName" placeholder="请输入关键字搜索">
                    </div>
                    <div class="form-actions  controls">
                        <button type="submit" class="button  button-primary">
                            查询
                        </button>
                    </div>

                </div>
            </li>
        </ul>
    </form>
    <div id="grid"></div>
<script>
    var contractID = getQueryString('contractID');//拿合同的id
    $("#searchForm").attr('action', '${basepath}/rest/manage/finance/selectFinancePage?contractID=' + contractID + '');
    var Grid = BUI.Grid,
            Store = BUI.Data.Store,
            columns = [
                {
                    title: '序号', elCls: 'center',
                    dataIndex: 'id',
                    width: '5%',
                    renderer: function (value, obj, index) {
                        return index + 1;
                    }
                },
                {
                    title: '收款类别', dataIndex: 'type', elCls: 'center', width: '10%', renderer: function (value) {
                        return value == 'proxy' ? '委托书' : '合同'
                    }
                },
                {
                    title: '名称', dataIndex: 'type', elCls: 'center', width: '10%', renderer: function (value,obj) {
                        return value == 'proxy' ? obj.proxyName : obj.contractName
                    }
                },
                {
                    title: '编号', dataIndex: 'type', elCls: 'center', width: '10%', renderer: function (value,obj) {
                        return value == 'proxy' ?  obj.proxySno : obj.contractSno
                    }
                },
                {title: '操作角色', dataIndex: 'roleName', elCls: 'center', width: '10%'},
                {title: '角色名称', dataIndex: 'userName', elCls: 'center', width: '10%'},
                {
                    title: '操作动作', dataIndex: 'isFirst', elCls: 'center', width: '10%', renderer: function (value) {
                        return value == 'y' ? '预付款' : '付款';
                    }
                },
                {
                    title: '收款金额', dataIndex: 'income', elCls: 'center', width: '10%'
                },
                {
                    title: '操作时间', dataIndex: 'createTime', elCls: 'center', width: '15%'
                },
                {
                    title: '备注',
                    dataIndex: 'remark',
                    elCls: 'center',
                    width: '10%',
                    renderer: function (value, obj, index) {
                        return value == "" || value == null ? "____" : value;
                    }
                }
            ];

    var store = new Store({
                url: '/rest/manage/finance/selectFinancePage?contractID=' + contractID + '',
                autoLoad: true, //自动加载数据
                params: { //配置初始请求的参数
                    length: '10',
                    status: $("#status").val()
                },
                pageSize: 10,	// 配置分页数目
                root: 'list',
                totalProperty: 'total'
            }),
            grid = new Grid.Grid({
                render: '#grid',
                columns: columns,
                loadMask: true, //加载数据时显示屏蔽层
                store: store,
                plugins: [Grid.Plugins.CheckSelection], // 插件形式引入多选表格
                // 底部工具栏
                bbar: {
                    pagingBar: true
                }
            });

    grid.render();
</script>

</@page.pageBase>
